import { MidwayConfig } from '@midwayjs/core';
import { env } from '../utils/functions';

export default {
  default: env('DB_DRIVER', 'mysql'),
  drivers: {
    mysql: {
      driver: env('DB_DRIVER', 'mysql'),
      host: env('DB_MYSQL_HOST', 'localhost'),
      port: env('DB_MYSQL_PORT', '3306'),
      database: env('DB_NAME', 'octopoda'),
      username: env('DB_USER', 'root'),
      password: env('DB_PASSWORD', 'root'),
      models: './entities/',
      orm: 'typeorm',
    },
    redis: {
      port: env('REDIS_PORT', 6379), // Redis port
      host: env('REDIS_HOST', '127.0.0.1'), // Redis host
      password: env('REDIS_PASSWORD', 'auth'),
      db: 0,
    },
  },
} as MidwayConfig;
